<h2>mach_subsystem_create</h2>
<hr>
<p>
<strong>Function</strong> - Register information about an RPC subsystem.
<h3>SYNOPSIS</h3>
<pre>
<strong>kern_return_t   mach_subsystem_create</strong>
                <strong>(task_t</strong>                             <var>target_task</var>,
                 <strong>user_subsystem_t</strong>                   <var>user_subsys</var>,
                 <strong>mach_msg_type_number_t</strong>          <var>user_subsysCnt</var>,
                 <strong>subsystem_t</strong>                        <var>subsystem_t</var><strong>);</strong>
</pre>
<h3>PARAMETERS</h3>
<dl>
<p>
<dt> <var>target_task</var>
<dd>
The task for which the subsystem is registered; normally the calling 
task, but not necessarily.
<p>
<dt> <var>user_subsys</var>
<dd>
The MIG-generated data structure describing the exported routines and 
their input/output characteristics (e.g. arguments and return values).
<p>
<dt> <var>user_subsysCnt</var>
<dd>
The size of the user_subsys data structure argument, in bytes.
<p>
<dt> <var>subsys</var>
<dd>
The port returned that names the registered subsystem.
</dl>
<h3>DESCRIPTION</h3>
<p>
The <strong>mach_subsystem_create</strong> function is used by a server to register
information about an RPC subsystem with the kernel.
MIG automatically generates, in the server source file, a
<strong>user_subsystem_t</strong> data structure that is appropriate for registering
the subsystem. This data structure includes a per-routine array that
specifies:
<ul>
<li>
The address of the server function that performs the work.
<li>
The address of the MIG-generated server-side marshalling stub, to be 
used with <strong>mach_msg</strong>.
<li>
The argument signature (i.e. NDR-style argument format) of the
routine.
</ul>
<p>
Upon successful completion, <strong>mach_subsystem_create</strong> returns,
via the <var>subsys</var> parameter, a port naming the registered subsystem.
<p>
Each port on which the server is to receive short-circuited RPC's (or
a <strong>mach_rpc</strong> call) must be associated with a registered subsystem, by
calling <strong>mach_port_allocate_subsystem</strong>.
<h3>RETURN VALUES</h3>
<dl>
<p>
<dt> <strong>KERN_INVALD_ADDRESS</strong>
<dd>
One or more of the addresses in the range specified by the subsystem
address and size are not valid addresses in the caller, or some of the
internal pointers in the subsystem do not point to places within the
address range (all of the data of the subsystem is required to be
contiguous, even the parts that are pointed to by other parts).
<p>
<dt> <strong>KERN_INVALID_ARGUMENT</strong>
<dd>
The port name specified by <var>target_task</var> is not a send right naming a task,
or the subsystem size is too small to be valid.
<p>
<dt> <strong>KERN_INVALID_TASK</strong>
<dd>
The target task is dead.
<p>
<dt> <strong>KERN_RESOURCE_SHORTAGE</strong>
<dd>
The kernel cannot allocate the subsystem due to insufficient available 
memory.
</dl>
<h3>RELATED INFORMATION</h3>
<p>
Functions:
<a href="MP_allocate_subsystem.html"><strong>mach_port_allocate_subsystem</strong></a>,
<a href="thread_activation_create.html"><strong>thread_activation_create</strong></a>.
